package com.ftx.controller.test.tree;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fengtingxin on 2021/4/1 9:25 上午
 * 二叉树啊，大哥
 */
public class BinaryTree {

    //来个递归形式的前序遍历吧

    //二叉树的节点
    static class TreeNode{
        TreeNode left;

        TreeNode right;

        int value;

        public TreeNode() {
        }

        public TreeNode getLeft() {
            return left;
        }

        public void setLeft(TreeNode left) {
            this.left = left;
        }

        public TreeNode getRight() {
            return right;
        }

        public void setRight(TreeNode right) {
            this.right = right;
        }

        public int getValue() {
            return value;
        }

        public void setValue(int value) {
            this.value = value;
        }
    }

    public static void main(String[] args) {
        TreeNode root = new TreeNode();
        List<Integer> result = new ArrayList<>();

    }


    //前序遍历啊
    public void preFace(TreeNode root, List<Integer> result){
        if (root == null){
            return;
        }
        result.add(root.value);
        preFace(root.left,result);
        preFace(root.right,result);

    }
}
